package com.atguigu.service.impl;

import com.atguigu.dao.UserManagerDao;
import com.atguigu.dao.impl.UserManagerDaoImpl;
import com.atguigu.pojo.UserManager;
import com.atguigu.service.UserManagerService;

import java.util.List;

public class UserManagerServiceImpl implements UserManagerService {

    UserManagerDao userManagerDao = new UserManagerDaoImpl();

    @Override
    public boolean Login(UserManager userManager) {
        List<UserManager> userAll = userManagerDao.getUserAll();
        for(UserManager manager: userAll){
            // 验证用户名和密码是否正确
            if(manager.getUsername().equals(userManager.getUsername()) && manager.getPassword().equals(userManager.getPassword())) {
                return true;
            }
        }
        return false;
    }
}
